package com.gaogzhen.threadPool.scheduledThreadPool;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.*;

@Slf4j(topic = "c.TestScheduledThreadPool01")
public class TestScheduledThreadPool03 {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        ScheduledExecutorService pool = Executors.newScheduledThreadPool(1);
        log.debug("start...");
        ScheduledFuture<?> future = pool.schedule(() -> {
            log.debug("task 1...");
            int i = 1 / 0;
            return true;
        }, 1, TimeUnit.SECONDS);
        System.out.println(future.get());
    }
}
